﻿<html>
	<form method="POST" action="createWork1.php" >
		選擇倉庫：
		<select name="_wareHouse">
			<option value="Taipei">Taipei</option>
			<option value="Kaoh">Kaoh</option>
			<option value="Tea">Tea</option>
		</select>
		<input type="submit" value="確定">
	</form>
<?php
	$_wareHouse = $_POST['_wareHouse'];
	if($_wareHouse != "")//已輸入
	{
		echo "位於" . $_wareHouse . "倉庫的貨件：<br>";
		$main = "<hr>";
		$link=mysql_connect("localhost", "root" ,"1123");
		mysql_select_db("dd") or die("No database");
		$query = "	Select tracking_number, weight, length, width, height, type, mailing_date, specified_delivery_date, end_warehouse
					from shipment natural join at
					where actual_delivery_date is NULL and name = '" . $_wareHouse . "';";
		$result = mysql_query($query) or die("Error Message:".mysql_error());
		$count = 0;
		$main .= '<form method="POST" action="createWork2.php" ><input type="hidden" name="_wareHouse" value="' . $_wareHouse . '">';
		$main .= '<table width="700" border="solid">';
		$main .= '<tr><td>選取</td><td>單號</td><td>重量</td><td>長</td><td>寬</td><td>高</td><td>類型</td><td>寄件日期</td><td>指定送達日期</td><td>目標倉庫</td>';
		while(list($a[0], $a[1], $a[2], $a[3], $a[4], $a[5], $a[6], $a[7], $a[8])= mysql_fetch_row($result))
		{
			$main .= '<tr><td><input type="radio" name="_trackNumber" value=' . $a[0] . '></td>';
			for($i = 0 ; $i < 9 ; $i++)
			{
				$main .= '<td>' . $a[$i] . '</td>';
			}
			$main .= '</tr>';
			$count += 1;
		}
		echo "共" . $count . "件";
		$main .= '</table>';
		$main .= '<input type="submit" name="" value="分配此項工作">';
		$main .= '</form>';
		echo $main;
		mysql_close ($link);
	}
?>
</html>